$(function(){
    var client_datagrid,client_search;
    client_datagrid = $("#client_datagrid");
    client_search =$("#searchbtn");

    client_datagrid.datagrid({
        url:'/sourceClient/list',
        fit:true,
        fitColumns:true,
        toolbar:'#datagrid_toolar',
        pagination:true,
        rownumbers:true,
        singleSelect:true,
        columns:[[
            {field:'clientType',title:'客户类型',width:100},
            {field:'username',title:'账号名',width:60},
            {field:'realName',title:'客户姓名',width:100},
            {field:'tel',title:'手机号',width:100},
            {field:'qq',title:'QQ',width:100},
            {field:'email',title:'邮箱',width:100},
            {field:'address',title:'地址',width:100},
            {field:'idCardType',title:'证件类型',width:100},
            {field:'idCardNumber',title:'证件号码',width:100},
            {field:'job',title:'职业',width:100},
            {field:'clientNumber',title:'客户代码',width:100},
            {field:'clientLevel',title:'客户级别',width:100}
        ]]
    });
    var cmdObj={
        //重新加载
        client_reload:function(){

        }
    };
    //搜索
    client_search.textbox({
        buttonText:'SEARCH',
        prompt:'Please Input Value',
        label:'关键字',
        labelPosition:'left',
        labelWidth:50,
        width:300,
        onClickButton:function(){
            client_datagrid.datagrid("load",{
                keyword:searchbtn.val()
            });
        }
    });
    $("a[data-cmd]").on("click",function(){
        var cmd = $(this).data("cmd");
        cmdObj[cmd]();
    })

});